<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8" isELIgnored="false"%>

<%
	request.setAttribute("title","学生详情");
	request.setAttribute("modelConfigPath", "contact");
%>

<%@ include file="/WEB-INF/views/shared/master/contentHeader.jsp"%>
<style type="text/css">

</style>

<t:panel cssClass="panel-flat form-detailed form-xs" customBody="true" customHead="true">
	<div class="detailed-navbar-content panel-body">
		<t:form commandName="student" action="/admin/user/student/save" method="post" cssClass="form-horizontal">
			<div class="hide">
				<t:hidden path="employeeId"/>
			</div>
			<t:formgroup>
				<div style="height:40px;margin:4px 0px">
					<t:label path="studentName" cssClass="col-sm-2" />
					<t:input path="studentName" colClass="col-sm-4" />
				</div>
				<div style="height:40px;margin:4px 0px">
					<t:label path="employeeAccount" cssClass="col-sm-2" />
					<t:input path="employeeAccount" colClass="col-sm-4" cssClass="markCode" data-markCodeFor="studentName" data-markFilter="account" />
				</div>
				<div style="height:40px;margin:4px 0px">
					<t:label path="mobile" cssClass="col-sm-2" />
					<t:input path="mobile" colClass="col-sm-4" />
				</div>
				<div style="height:40px;margin:4px 0px">
					<t:label path="email" cssClass="col-sm-2"  />
					<t:input path="email" colClass="col-sm-4" />
				</div>
				<div style="height:20%;width:20%;margin-top:-180px;margin-left:520px">
					<t:input path="avatar" style="display:none"/>
					<img style="height:100%;width:100%;border-radius:50%;" alt="暂无照片" src="${student.avatar }" 
						 onerror="javascript:this.src='<c:url value="/images/default_avatar.jpg" />'" 
						 id="studentAvatar" name="studentAvatar"
						 onclick="selectAvatar()" />
				</div>
			</t:formgroup>
			<t:formgroup>
				<t:label path="studentId" cssClass="col-sm-2" />
				<t:input path="studentId" colClass="col-sm-4" />
				<t:label path="sex" cssClass="col-sm-2" />
				<t:selectButton path="sex" colClass="col-sm-4" />
			</t:formgroup>
			<t:formgroup>
				<t:label path="admissionDate" cssClass="col-sm-2" />
				<t:date path="admissionDate" colClass="col-sm-4" />
				<t:label path="teacherId" cssClass="col-sm-2"  />
				<t:select2 path="teacherId" colClass="col-sm-4" />
			</t:formgroup>
			<t:formgroup>
				<t:label path = "roleIds" cssClass="col-sm-2"/>
				<t:select2 path="roleIds" multiple="true" colClass="col-sm-4"/>
			</t:formgroup>
			<t:formgroup>
				<t:label path="comments" cssClass="col-sm-2"  />
				<t:textarea path="comments" rows="5" colClass="col-sm-10" />
			</t:formgroup>
		</t:form>
	</div>
	<t:panelFoot headingBtnCssClass="heading-btn pull-right-important">
		<t:button icon="icon-floppy-disk" onclick="saveData()" cssClass="btn-info" csize="sm">保存</t:button>
	</t:panelFoot>
</t:panel>

<iframe id="uploadAvatar" name="uploadAvatar" style="display:none" src="<c:url value='/admin/user/upload/uploadAvatar/' />" ></iframe>

<script type="text/javascript">
	function saveData(){
		if (!$("form:first").valid()){
			return;
		}
		$("form:first").submit();
	}
	
	function selectAvatar(){
		window.frames["uploadAvatar"].$("#openFile").click();
	}
	
	function setAvatar(imgInfo){
		if(null==imgInfo||""==imgInfo)
			return;
		var avatarPath="<c:url value='/images/avatar/' />"+imgInfo;
		$("#avatar").val(avatarPath);
		$("#studentAvatar").attr("src",avatarPath);
	}
</script>

<%@ include file="/WEB-INF/views/shared/scripts/jqueryui.jsp"%>
<%@ include file="/WEB-INF/views/shared/base/scripts/limitless/default/formselects.jsp"%>
<%@ include file="/WEB-INF/views/shared/base/scripts/limitless/default/formstyling.jsp"%>
<%@ include file="/WEB-INF/views/shared/base/scripts/limitless/default/formpickers.jsp"%>
<%@ include file="/WEB-INF/views/shared/master/dialog.jsp"%>
<%@ include file="/WEB-INF/views/shared/master/contentFooter.jsp"%>